# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Simon Sapin <simon dot sapin at exyr dot org>
# Contributor: Kyle Keen <keenerd@gmail.com>

pkgname=python-stestr
pkgver=4.0.1
pkgrel=4
pkgdesc="A test runner runner similar to testrepository"
url="https://stestr.readthedocs.io/en/latest/"
license=('Apache')
arch=('any')
depends=('python-future' 'python-cliff' 'python-pbr' 'python-subunit' 'python-fixtures'
         'python-testtools' 'python-yaml' 'python-voluptuous')
checkdepends=('python-hacking' 'python-sphinx' 'python-coverage'
              'python-ddt')
source=("https://pypi.io/packages/source/s/stestr/stestr-$pkgver.tar.gz")
sha512sums=('a74b9278b1941da62af58a087a10e5a0624901ceb81dcdd25eab3a05f003756773551fe6eec46dfb371f7b726cf296abfe0116444fb32c94fb6811440ee22a58')

build() {
  cd stestr-$pkgver
  python setup.py build
}

check() {
  cd stestr-$pkgver
  local python_version=$(python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
  python setup.py install --root="$PWD/tmp_install" --optimize=1
  (
    export PYTHONPATH="$PWD/tmp_install/usr/lib/python${python_version}/site-packages"
    export PATH="$PWD/tmp_install/usr/bin:$PATH"
    stestr run
  )
}

package() {
  cd stestr-$pkgver
  python setup.py install --root="$pkgdir" --optimize=1
}
